<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="utf-8">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/font-awesome.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/carousel.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/carousel.css">
    <style>
        #footer {
            padding: 15px 0;
            background: #fff;
            border-top: 1px solid #ddd;
            text-align: center;
        }

        #typeList :not(:first-child) {
            margin-top: 20px;
        }

        h3.break > a {
            text-decoration: none;
        }

        #logoimg {
            float: left;
            width: 150px;
            height: 50%;
            padding: 5px 5px;
        }

    </style>
</head>
<body>
<div class="navbar-wrapper ">
    <div class="container ">
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <img id="logoimg" src="${pageContext.request.contextPath}/resources/img/logo2.png"/>
                    <a class="navbar-brand" href="${pageContext.request.contextPath}/index.jsp" style="font-size:32px;">在线报修平台</a>
                </div>
                <c:if test="${account == null}">
                    <div id="navbar" class="navbar-collapse collapse" style="float:right;">
                        <ul class="nav navbar-nav navbar-right">
                            <li><a href="${pageContext.request.contextPath}/page/login-user.jsp">用户登录</a></li>
                            <li><a href="${pageContext.request.contextPath}/page/leader/login-leader.jsp">负责人登录</a></li>
                            <li><a href="${pageContext.request.contextPath}/page/register.jsp">我要注册</a></li>
                            <li class="dropdown">
                        </ul>
                    </div>
                </c:if>
                <c:if test="${account !=null && hasRole == 'hasUser'}">
                    <div id="navbar1" class="navbar-collapse collapse" style="float:right;">
                        <ul class="nav navbar-nav navbar-right">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i
                                    class="glyphicon glyphicon-user"></i>欢迎 &nbsp; ${account}&nbsp;<span
                                    class="caret"></span></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li>
                                        <a rel="nofollow" href="${pageContext.request.contextPath}/userpage"><i
                                            class="glyphicon glyphicon-th-large"></i> 报修申请</a>
                                    </li>
                                    <li>
                                        <a rel="nofollow" href="${pageContext.request.contextPath}/userpage-2"><i
                                            class="glyphicon glyphicon-edit"></i> 我的报修</a>
                                    </li>
                                    <li>
                                        <a rel="nofollow" href="${pageContext.request.contextPath}/userpage-3"><i
                                            class="glyphicon glyphicon-user"></i> 修改信息</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li><a href="${pageContext.request.contextPath}/user/quit"><i
                                        class="glyphicon glyphicon-off"></i> 退出系统</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </c:if>
                <c:if test="${account !=null && hasRole == 'hasLeader'}">
                    <div id="navbar1" class="navbar-collapse collapse" style="float:right;">
                        <ul class="nav navbar-nav navbar-right">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i
                                    class="glyphicon glyphicon-user"></i>欢迎 &nbsp; ${account}&nbsp;<span
                                    class="caret"></span></a>
                                <ul class="dropdown-menu" role="menu">

                                    <li>
                                        <a rel="nofollow" href="${pageContext.request.contextPath}/leaderpage"><i
                                            class="glyphicon glyphicon-th-large"></i>报修申请单</a>
                                    </li>
                                    <li>
                                        <a rel="nofollow" href="${pageContext.request.contextPath}/gaipaipage"><i
                                            class="glyphicon glyphicon-th-large"></i>改派申请</a>
                                    </li>
                                    <li>
                                        <a rel="nofollow" href="${pageContext.request.contextPath}/qjListpage"><i
                                            class="glyphicon glyphicon-th-large"></i>请假申请单</a>
                                    </li>
                                    <li>
                                        <a rel="nofollow"
                                           href="${pageContext.request.contextPath}/tbQingjia/inQingJiaPage?leaderAccount=${account}"><i
                                            class="glyphicon glyphicon-th-large"></i>请假申请</a>
                                    </li>
                                    <li>
                                        <a rel="nofollow" href="${pageContext.request.contextPath}/leaderpage-3"><i
                                            class="glyphicon glyphicon-user"></i> 修改信息</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li><a href="${pageContext.request.contextPath}/user/quit"><i
                                        class="glyphicon glyphicon-off"></i> 退出系统</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </c:if>
                <c:if test="${account !=null && hasRole == 'hasAdmin'}">
                    <div id="navbar1" class="navbar-collapse collapse" style="float:right;">
                        <ul class="nav navbar-nav navbar-right">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i
                                    class="glyphicon glyphicon-user"></i>欢迎 &nbsp; ${account}&nbsp;<span
                                    class="caret"></span></a>
                                <ul class="dropdown-menu" role="menu">
                                        <%--留空--%>
                                    <li class="divider"></li>
                                    <li><a href="${pageContext.request.contextPath}/user/quit"><i
                                        class="glyphicon glyphicon-off"></i> 退出系统</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </c:if>
            </div>
        </nav>
    </div>
    <div class="container theme-showcase" role="main" style="margin-top: 5%;">
        <div class="container">
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <nav class="navbar navbar-default" role="navigation">
                        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                            <ul class="nav navbar-nav wrap">
                                <li>
                                    <a rel="nofollow" href="${pageContext.request.contextPath}/index.jsp"><i
                                        class="glyphicon glyphicon-home"></i> 首页</a>
                                </li>
                                <li>
                                    <a rel="nofollow"
                                       href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=-1"><i
                                        class="glyphicon glyphicon-th-large"></i> 全部</a>
                                </li>
                                <li>
                                    <a rel="nofollow"
                                       href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=1"><i
                                        class="glyphicon glyphicon-edit"></i> 电脑入门</a>
                                </li>
                                <li>
                                    <a rel="nofollow"
                                       href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=2"><i
                                        class="glyphicon glyphicon-edit"></i> 故障中心</a>
                                </li>
                                <li>
                                    <a rel="nofollow"
                                       href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=3"><i
                                        class="glyphicon glyphicon-edit"></i> IT资讯</a>
                                </li>

                            </ul>
                        </div>
                    </nav>
                </div>
            </div>
        </div>

        <div class="container">
            <div class="row clearfix">
                <div class="col-md-12 column">

                    <ul id="divshow3" class="thumbnails">
                        <c:forEach var="tbEssay" items="${tbEssayPageInfo.list}">
                            <li class="span4">
                                <div class="caption">
                                    <p style="text-overflow:ellipsis;white-space:nowrap; overflow:hidden;"><a
                                        href="/tbEssay/selectOne?essayId=${tbEssay.essayId}"><span
                                        style="color: #2a6496; font-family: 微软雅黑;font-size: medium"
                                        data-toggle="tooltip" title="">${tbEssay.essayTitle}</span></a></p>
                                    <p style="text-overflow:ellipsis;"><span data-toggle="tooltip"
                                                                             title="'+data.list[i].essayBrief+'">${tbEssay.essayBrief}</span>
                                    </p>
                                    <p align="right"><span
                                        style="color: #d43f3a; font-family: 微软雅黑;font-size: medium"><fmt:formatDate
                                        value="${tbEssay.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/> </span>
                                    </p>
                                </div>
                            </li>
                        </c:forEach>
                    </ul>

                </div>
            </div>
        </div>

        <div class="container">
            <div class="row clearfix">
                <div class="col-md-12 column" style="text-align:center">

                    当前${tbEssayPageInfo.pageNum }页,总${tbEssayPageInfo.pages }页,总${tbEssayPageInfo.total }条记录
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row clearfix">
                <div class="col-md-12 column" style="text-align:center">
                    <ul class="pagination">
                        <li>
                            <c:if test="${essayType == null}">
                                <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?page=1">首页</a>
                            </c:if>
                            <c:if test="${essayType == 1}">
                                <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=1&page=1">首页</a>
                            </c:if>
                            <c:if test="${essayType == 2}">
                                <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=2&page=1">首页</a>
                            </c:if>
                            <c:if test="${essayType == 3}">
                                <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=3&page=1">首页</a>
                            </c:if>
                        </li>
                        <!-- 判断是否有上一页，以便显示点击按钮 -->
                        <c:if test="${tbEssayPageInfo.hasPreviousPage }">
                            <li>
                                <c:if test="${essayType == null}">
                                    <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?page=${tbEssayPageInfo.pageNum-1 }"
                                       aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </c:if>
                                <c:if test="${essayType == 1}">
                                    <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=1&page=${tbEssayPageInfo.pageNum-1}"
                                       aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </c:if>
                                <c:if test="${essayType == 2}">
                                    <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=2&page=${tbEssayPageInfo.pageNum-1}"
                                       aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </c:if>
                                <c:if test="${essayType == 3}">
                                    <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=3&page=${tbEssayPageInfo.pageNum-1}"
                                       aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </c:if>
                            </li>
                        </c:if>
                        <!-- 遍历页码 -->
                        <c:forEach items="${tbEssayPageInfo.navigatepageNums }" var="page_Num">
                            <c:if test="${page_Num == tbEssayPageInfo.pageNum }">
                                <li class="active"><a href="#">${page_Num }</a></li>
                            </c:if>
                            <c:if test="${page_Num != tbEssayPageInfo.pageNum }">
                                <li>
                                    <c:if test="${essayType == null}">
                                        <a
                                            href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?page=${page_Num }">${page_Num }</a>
                                    </c:if>
                                    <c:if test="${essayType == 1}">
                                        <a
                                            href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=1&page=${page_Num }">${page_Num }</a>
                                    </c:if>
                                    <c:if test="${essayType == 2}">
                                        <a
                                            href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=2&page=${page_Num }">${page_Num }</a>
                                    </c:if>
                                    <c:if test="${essayType == 3}">
                                        <a
                                            href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=3&page=${page_Num }">${page_Num }</a>
                                    </c:if>
                                </li>
                            </c:if>
                        </c:forEach>
                        <!-- 判断是否有下一页 -->
                        <c:if test="${tbEssayPageInfo.hasNextPage }">
                            <li>
                                <c:if test="${essayType == null}">
                                    <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?page=${tbEssayPageInfo.pageNum+1 }"
                                       aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </c:if>
                                <c:if test="${essayType == 1}">
                                    <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=1&page=${tbEssayPageInfo.pageNum+1 }"
                                       aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </c:if>
                                <c:if test="${essayType == 2}">
                                    <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=2&page=${tbEssayPageInfo.pageNum+1 }"
                                       aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </c:if>
                                <c:if test="${essayType == 3}">
                                    <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=3&page=${tbEssayPageInfo.pageNum+1 }"
                                       aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </c:if>
                            </li>
                        </c:if>

                        <li>
                            <c:if test="${essayType == null}">
                                <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?page=${tbEssayPageInfo.pages }">末页</a>
                            </c:if>
                            <c:if test="${essayType == 1}">
                                <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=1&page=${tbEssayPageInfo.pages }">末页</a>
                            </c:if>
                            <c:if test="${essayType == 2}">
                                <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=2&page=${tbEssayPageInfo.pages }">末页</a>
                            </c:if>
                            <c:if test="${essayType == 3}">
                                <a href="${pageContext.request.contextPath}/tbEssay/queryAllBytype?essayType=3&page=${tbEssayPageInfo.pages }">末页</a>
                            </c:if>
                        </li>
                    </ul>


                </div>
            </div>
        </div>
    </div>
</div>
<script src="${pageContext.request.contextPath}/resources/jquery/jquery-2.1.1.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/script/docs.min.js"></script>
<script src="${pageContext.request.contextPath}/resources/script/back-to-top.js"></script>
<script>
    $(function () {
        $(".wrap li").click(function () {
            $(this).siblings('li').removeClass('active');  // 删除其兄弟元素的样式
            $(this).addClass('active');                    // 为点击元素添加类名
        });
    });
</script>
</body>
</html>